using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CrackShotEditor
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.MouseLeftButtonDown += this.MoveWindow;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        void MoveWindow(object sender,MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                texta.AppendText("\n" + GName.GetLineText(0) + ":");
                texta.AppendText("\n    Item_Information");
                texta.AppendText("\n        Item_Name: " + ItemName.GetLineText(0));
                texta.AppendText("\n        Item_Type: " + ItemID.GetLineText(0));
                texta.AppendText("\n        Item_Lore: " + ItemLore.GetLineText(0));
                texta.AppendText("\n        Inventory_Control: " + InvControl.GetLineText(0));
                texta.AppendText("\n        Skip_Name_Check: " + NameCheck.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Sounds_Acquired: BAT_TAKEOFF-1-1-0");
                texta.AppendText("\n    Shooting:");
                texta.AppendText("\n        Disable: " + DisableShooting.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Dual_Wield: " + DualWield.IsChecked.ToString().ToLower());
                ComboBoxItem ShootingClickI = (ComboBoxItem)ShootingClick.SelectedItem;
                if (ShootingClickI.Content.ToString().Equals("左键"))
                {
                    texta.AppendText("\n        Right_Click_To_Shoot: false");
                }
                else
                {
                    texta.AppendText("\n        Right_Click_To_Shoot: true");
                }
                texta.AppendText("\n        Cancel_Left_Click_Block_Damage: " + CancelInteractions.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Cancel_Right_Click_Interactions: " + CancelInteractions.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Delay_Between_Shots: " + ShotDelay.GetLineText(0));
                texta.AppendText("\n        Recoil_Amount: " + RecoilAmount.GetLineText(0));
                texta.AppendText("\n        Projectile_Amount: " + ProjectileAmount.GetLineText(0));
                ComboBoxItem Projectile = (ComboBoxItem)ProjectileCB.SelectedItem;
                if (Projectile.Content.ToString().Equals("雪球"))
                {
                    texta.AppendText("\n        Projectile_Type: snowball");
                }
                else if (Projectile.Content.ToString().Equals("弓箭"))
                {
                    texta.AppendText("\n        Projectile_Type: arrow");
                }
                else if (Projectile.Content.ToString().Equals("鸡蛋"))
                {
                    texta.AppendText("\n        Projectile_Type: egg");
                }
                else if (Projectile.Content.ToString().Equals("榴弹"))
                {
                    texta.AppendText("\n        Projectile_Type: grenade");
                }
                else if (Projectile.Content.ToString().Equals("信号弹"))
                {
                    texta.AppendText("\n        Projectile_Type: flare");
                }
                else if (Projectile.Content.ToString().Equals("火球"))
                {
                    texta.AppendText("\n        Projectile_Type: fireball");
                }
                else if (Projectile.Content.ToString().Equals("凋零头颅"))
                {
                    texta.AppendText("\n        Projectile_Type: witherskull");
                }
                texta.AppendText("\n        Remove_Arrows_On_Impact: true");
                texta.AppendText("\n        Projectile_Speed: " + ProjectileSpeed.GetLineText(0));
                texta.AppendText("\n        Projectile_Damage: " + ProjectileDamage.GetLineText(0));
                texta.AppendText("\n        Projectile_Flames: " + IsOnFire.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Bullet_Spread: " + BulletSpread.GetLineText(0));
                texta.AppendText("\n    Sneak:");
                texta.AppendText("\n        Enable: " + SneakEnable.IsChecked.ToString().ToLower());
                texta.AppendText("\n        No_Recoil: " + SneakNoKickback.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Bullet_Spread: " + SneakBulletSpread.GetLineText(0));
                texta.AppendText("\n        Sneak_Before_Shooting: " + MustSneak.IsChecked.ToString().ToLower());
                texta.AppendText("\n    Fully_Automatic:");
                texta.AppendText("\n        Enable: " + EnableFA.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Fire_Rate: " + FASpeed.GetLineText(0));
                texta.AppendText("\n    Burstfire:");
                texta.AppendText("\n        Enable: " + EnableBA.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Shots_Per_Burst: " + BAAmount.GetLineText(0));
                texta.AppendText("\n        Delay_Between_Shots_In_Burst: " + BACoolDown.GetLineText(0));
                texta.AppendText("\n    Ammo:");
                texta.AppendText("\n        Enable: " + EnableAmmo.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Ammo_Item_ID: " + AmmoID.GetLineText(0));
                texta.AppendText("\n        Ammo_Name_Check: " + AmmoName.GetLineText(0));
                texta.AppendText("\n        Take_Ammo_Per_Shot: " + AmmoEveryShot.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Sounds_Out_Of_Ammo: NOTE_PLING-1-2-0");
                texta.AppendText("\n        Sounds_Shoot_With_No_Ammo: NOTE_STICKS-1-2-0");
                texta.AppendText("\n    Reload:");
                texta.AppendText("\n        Enable: " + EnableReload.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Reload_With_Mouse: " + ReloadUseMouse.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Starting_Amount: " + ReloadStart.GetLineText(0));
                texta.AppendText("\n        Reload_Amount: " + ClipSize.GetLineText(0));
                texta.AppendText("\n        Reload_Bullets_Individually: " + ReloadPerBullet.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Take_Ammo_On_Reload: " + ReloadUseAmmo.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Take_Ammo_As_Magazine: " + ReloadAmmoIsMag.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Reload_Duration: " + ReloadTime.GetLineText(0));
                texta.AppendText("\n        Sounds_Out_Of_Ammo: ITEM_BREAK-1-1-0\n        Sounds_Reloading: FIRE_IGNITE-1-1-4,DOOR_OPEN-1-2-6,FIRE_IGNITE-1-1-36,HURT_FLESH-1-0-37,DOOR_CLOSE-1-2-38");
                texta.AppendText("\n    Firearm_Action:");
                ComboBoxItem act = (ComboBoxItem)ActionType.SelectedItem;
                if (act.Content.ToString().Equals("滑栓"))
                {
                    texta.AppendText("\n        Type: slide");
                }
                else if (act.Content.ToString().Equals("切换"))
                {
                    texta.AppendText("\n        Type: lever");
                }
                else if (act.Content.ToString().Equals("栓动"))
                {
                    texta.AppendText("\n        Type: pump");
                }
                else if (act.Content.ToString().Equals("左轮"))
                {
                    texta.AppendText("\n        Type: break");
                }
                texta.AppendText("\n        Open_Duration: " + FiAO.GetLineText(0));
                texta.AppendText("\n        Close_Duration: " + FiAC.GetLineText(0));
                texta.AppendText("\n    Scope:");
                texta.AppendText("\n        Enable: " + EnableScope.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Night_Vision: " + ScopeNV.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Zoom_Amount: " + ScopeZoom.GetLineText(0));
                texta.AppendText("\n        Zoom_Before_Shooting: " + ScopeMust.IsChecked.ToString().ToLower());
                texta.AppendText("\n        Sounds_Toggle_Zoom: ENDERDRAGON_WINGS-1-2-0");
            }
            catch (NullReferenceException)
            {

            }
            catch (ArgumentNullException)
            {

            }
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            texta.Clear();
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            new Window1().Show();
        }
    }
}
